// 完整引入 Element
import Vue from 'vue'
// import Element from 'element-ui'
import VueI18n from 'vue-i18n'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import ElementLocale from 'element-ui/lib/locale'

// 引入自定义中文包
import customZh from './zh'
// 引入自定义英文包
import customEn from './en'

Vue.use(VueI18n)

const i18n = new VueI18n({
  locale: 'en', // set locale
  messages: {
    en: {
      ...enLocale, // 或者用 Object.assign({ message: 'hello' }, enLocale)
      ...customEn
    },
    zh: {
      ...zhLocale, // 或者用 Object.assign({ message: '你好' }, zhLocale)
      ...customZh
    }

  }})

ElementLocale.i18n((key, value) => i18n.t(key, value))

export default i18n
